package come.bjpowernode.javase.thread;
/*
了解：关于线程的优先级
 */
public class ThreadTest11 {
    public static void main(String[] args) {
        System.out.println("最高优先级" + Thread.MAX_PRIORITY);
        System.out.println("最低优先级" + Thread.MIN_PRIORITY);
        System.out.println("默认优先级" + Thread.NORM_PRIORITY);

        Thread.currentThread().setPriority(10);
        //创建线程
        Thread t1 = new Thread(new MyRunnable5());
        t1.setName("t1");
        t1.start();


        for(int i = 0;i<10000;i++){
            System.out.println(Thread.currentThread().getName()
                    +"-->" + i );
        }

        /*//获取当前线程的优先级
        Thread t = Thread.currentThread();
        System.out.println(t.getName() + "的默认优先级为"
                + t.getPriority());*/


    }
}
class MyRunnable5 implements Runnable{
    public void run(){
        //获取线程的优先级
        System.out.println(Thread.currentThread().getName()+
                "的优先级为" + Thread.currentThread().getPriority());

        for(int i = 0;i<10000;i++){
            System.out.println(Thread.currentThread().getName()
                    +"-->" + i );
        }
    }
}